package com.yolib.sanyi;


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class MainActivity extends Activity implements OnClickListener{

	private ImageView mNews;
	private ImageView mMap;
	private ImageView mStory;
	private ImageView mScene;
	private ImageView mTraffic;
	private ImageView mItinerary;
	private ImageView mHowKang;
	private ImageView mFacebook;
	private ImageView mAbout;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		mNews		=	(ImageView)	findViewById(R.id.main_news);
		mMap		=	(ImageView)	findViewById(R.id.main_map);
		mStory		=	(ImageView)	findViewById(R.id.main_story);
		mScene		=	(ImageView)	findViewById(R.id.main_scene);
		mTraffic	=	(ImageView)	findViewById(R.id.main_traffic);
		mItinerary	=	(ImageView)	findViewById(R.id.main_itinerary);
		mHowKang	=	(ImageView)	findViewById(R.id.main_howkang);
		mFacebook	=	(ImageView)	findViewById(R.id.main_facebook);
		mAbout		=	(ImageView)	findViewById(R.id.main_aboutus);

		mNews.setOnClickListener(this);
		mMap.setOnClickListener(this);
		mStory.setOnClickListener(this);
		mScene.setOnClickListener(this);
		mTraffic.setOnClickListener(this);
		mItinerary.setOnClickListener(this);
		mHowKang.setOnClickListener(this);
		mFacebook.setOnClickListener(this);
		mAbout.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		Intent mIntent = null;
		switch (v.getId()) {
		case R.id.main_news:
			mIntent = new Intent(MainActivity.this, NewsActivity.class);
			break;
		case R.id.main_map:
			mIntent = new Intent(MainActivity.this, MapReviewActivity.class);
			break;
		case R.id.main_story:
			mIntent = new Intent(MainActivity.this, StoryActivity.class);
			break;
		case R.id.main_scene:
			mIntent = new Intent(MainActivity.this, DiscoverActivity.class);
			break;
		case R.id.main_traffic:
			mIntent = new Intent(MainActivity.this, TravelActivity.class);
			break;
		case R.id.main_itinerary:
			mIntent = new Intent(MainActivity.this, TrafficActivity.class);
			break;
		case R.id.main_howkang:
			mIntent = new Intent(MainActivity.this, HowKangActivity.class);
			break;
		case R.id.main_facebook:
			 Uri uri = Uri.parse("https://m.facebook.com/sanyiwalking");
			 mIntent = new Intent(Intent.ACTION_VIEW, uri);
			break;
		case R.id.main_aboutus:
			mIntent = new Intent(MainActivity.this, AboutUsActivity.class);
			break;
		}
		if(mIntent != null) {
			MainActivity.this.startActivity(mIntent);
			overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
		}
	}
}
